<?php
/**
 * autoCompleteJSON.php 
 * andrew mahon
 */
//require_once('../../../wp-config.php');

$output = array();

$myPosts = new WP_Query("category_name=projects&nopaging=true");

while($myPosts->have_posts()):
	$myPosts->the_post();
	$myTitle = (object)array();
	$myTitle->label = $post->post_title."<span class='type'>Project</span>";
	$myTitle->value = $post->post_title;
	$output[] = $myTitle;
	
	foreach(get_post_meta($post->ID, "author", false) as $author){
		$myAuthor = (object)array();
		$myAuthor->label = $author."<span class='type'>Designer</span>";
		$myAuthor->value = $author;
		$output[] = $myAuthor;
	}
endwhile;

$searchAutoComplete = json_encode($output);

wp_reset_query();

?>